
# 日志相关视图
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from LogisticsCard.models import Log


@login_required
def logs_view(request):
    """
    日志视图，展示最近的操作日志。
    :param request: HttpRequest对象
    :return: 渲染日志列表页面
    """
    logs = Log.objects.select_related('user').order_by('-created_at')[:200]
    return render(request, 'logs/index.html', {'logs': logs})
